home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
asmutil
/
asm_n_z.zip
/
PLIST.ASM
< prev
next >
Wrap
Assembly Source File
|
1986-06-27
|
29KB
|
963 lines
name plist
page 78,132
title PLIST12 --- Print text file (version 1.2A)
; Zider Brothers, San Francisco
;
; Based on LIST.ASM by Ray Duncan
;
;6.27 Fixed output buffer bug.
; Added version id on help screen.
; Added PLIST id to error messages.
; Fixed automatic computation of remaining available space
; (courtesy Chris Dunford via Vern Buerg).
;
;6.5.86 Fixed title buffer init to conform to page offset, line
; width parms.
; Fixed end-of-input processing (now does not pump out extra
; line with pg_offset pad plus line feed)
;
;6.4.86 Add /7 option to strip hi-bit (make ok 8-bit the default now)
; Enlarged I/O buffers to max space available (64K assumed - may
; blow system if full 64KB not available for code).
; DEL char (07Fh or 127 decimal) is now treated as low-order control
; character.
; Add /b option for blanks substituted for low-order control chars
; (Default is that non-special treatment control chars are discarded
; from the output listing stream to keep output devices from
; interpreting WordStar embedded print control chars).
; Change default output file to zz.spl (from zz.lst).
; Speed on AT 6/1 around 90-100K bps, and about 11-17,000 lines per minute.
;
;5.8.85 Add std error out for error messages
; Disable code that toggles lpi, cpi on exit if parm was exercised
; Change to COM file format
; Input buffer moved to end, fill above program
; Change input block size to 4096 bytes (for DOS 2.0 hard disk)
; Conversion speed from 14K bps to 19K bps, depending on tabs expansion
; Make ZZ.LST the default (file) output--21K-24K bps (bits per second)
;
;5.7.85 Make compressed, 8 lpi the default (using IBM PC Graphics printer)
; Add /N option to get uncompressed print ("normal" print)
; Exit print without changing settings if none set, toggle back if set
; Disable FF bracketing, make no FF's at begin/end the default
; Add /F switch to enable lead-in FF (tail end still disabled)
; Add /S switch to print to std output device (so can redirect to file)
; Change name to PLIST to avoid confusion with LIST545, etc by Vern Buerg
; Add syntax, options help when null command line tail
; Add page offset of 8 spaces
; Added clarifying comments, code section identification breaks.
;
;5.6.85 Hack to add 8 Lines Per Inch option (/8)
;
;-----original documentation:
;
; LIST --- a utility to print out text files with titles and page
; numbers on the current list device. The high bit of all
; characters is stripped [this option now must be specified on the command
; line with the /7 option], so that raw Wordstar or other word
; processing files can be listed. Embedded form feed codes are
; recognized, and tabs are expanded. Unknown control codes (such
; as the ^B and ^U codes found in Wordstar documents) are discarded.
; If using an Epson printer, compressed mode can be turned on with
; /C switch in command so that lines up to 128 characters long will
; fit on a normal page. Requires PC-DOS 2.0 or MS-DOS 2.0.
; Used in the form:
; A>LIST path\filename.ext ["title text"] [/C]
; (items in square brackets are optional)
; version 1.0 February 28, 1984
; Copyright (c) 1984 by Ray Duncan
; May be freely reproduced for non-commercial use.
cr equ 0dh ;ASCII carriage return
lf equ 0ah ;ASCII line feed
ff equ 0ch ;ASCII form feed
eof equ 01ah ;End of file marker
tab equ 09h ;ASCII tab character
blank equ 20h ;space character
command equ 80h ;buffer for command tail
prog_size = offset end_code ; s/b about 09f6h
end_segment equ 0ffffh
stack_space equ 100h
avail = end_segment-(offset end_code - cseg) - stack_space
;avail2 = end_segment-prog_size-stack_space ;gives error
public buf_size
;buf_size equ 1024
buf_size equ avail/2
public output_buffer
output_buffer equ prog_size+buf_size
chk_stack equ output_buffer+buf_size+1
stack_start equ end_segment-stack_space+1
inblksize equ buf_size
outblksize equ buf_size
;inblksize equ 8192 ;size of block reads from input file
;outblksize equ 8192 ;size of block writes to output file
pg_offset equ 8 ;set page offset to 8 spaces
linesize equ 132-pg_offset ;maximum length of output line
page6lpi equ 58 ;58 out of 66 lines
page8lpi equ 80 ;80 of of 88 lines
heading_lines equ 3 ;number of lines in page heading
std_out equ 1 ;standard output
std_error equ 2 ;standard error--not redirectable
std_printer equ 4 ;standard printer
page
cseg segment para public 'CODE'
;old assume:
; assume cs:cseg,ds:data,es:data,ss:stack
assume cs:cseg,ds:cseg,es:cseg,ss:cseg
org 100H
ENTRY: jmp start
;
;DATA area at end of the program.
;
who_am_i db 'PLIST12: Zider Brothers, San Francisco'
start:
list proc far ;entry point from PC-DOS
push ds ;save DS:0000 for final
xor ax,ax ;return to PC-DOS
push ax
list13: ;make sure we're running under DOS 2.0.
mov ah,30h
int 21h
cmp al,2
jae list01 ;proceed, DOS 2.0 or greater
mov dx,offset msg3 ;DOS 1.x --- print error message
mov cx,msg3_len
jmp list9
;----------------------------------------------------------
; Process command line
list01: call get_title ;get listing title from
;command line tail.
call get_switch ;look for /C, /N, /6, /8, etc switches, if any
call get_filename ;get path and file spec. for
;input file from command line tail.
jnc list15 ;jump, got acceptable name.
mov dx,offset msg2 ;missing or illegal filespec,
mov cx,msg2_len
jmp list9 ;print error message and exit.
;----------------------------------------------------------
; Open input file
list15: call open_input ;now try to open input file
jnc list2 ;jump,opened input ok
mov dx,offset msg1 ;open of input file failed,
mov cx,msg1_len
jmp list9 ;print error msg and exit.
;----------------------------------------------------------
; Open output file
list2:
cmp s_switch,0 ;output to std out?
jne list25 ;jump if DOS std output selected
call open_zzlst ;open default output file
jnc list25 ;skip if ok open
mov dx,offset zzmsg ;opening default file error
mov cx,zzmsg_len
jmp list9 ;print error msg and xit.
;----------------------------------------------------------
; Initialization
list25: call init_buff ;initialize input deblocking buffer
;----------------------------------------------------------
; Set page, printer configuration
list20: test compress_switch,-1 ;was /C switch found?
jz list21
call compress_on ;yes,turn on compressed print mode
list21: test ate_lpi,-1 ;/8 switch found?
jz list22
call ate_on
list22: test six_lpi,-1 ;/6 switch found?
jz list23
call six_on
list23: test norm_switch,-1 ;was /N switch found?
jz list3
call compress_off
;===============================================================;
; Main program control loop ;
; ;
;----------------------------------------------------------
; Process character input stream
list3:
call get_char ;read 1 character from input.
cmp al,20h ;is it a low-order control code?
jb short list30 ;yes, go check out what kind.
cmp al,07fh ;not low-order, pivot on DEL char (127 decimal)
jb list4 ;ok char, write to list device.
je short list30 ;treat it like low-order control char.
mod1 label word
nop ;high bit is set on char = upper 128 chars.
nop ;..two bytes here may be modified to
; 'and al,07h' by /7 option to strip hi-bit.
; Otherwise code falls through to jmp:
jmp list4 ;now write to list device.
list30: cmp al,tab ;is it a tab command?
je list5 ;yes,jump to special processing.
cmp al,cr ;carriage return?
jne list31 ;
mov column,0 ;carriage return, store it into output
jmp list45 ; string and initialize column count.
list31: cmp al,lf ;is it a line feed?
je list7 ;yes,jump to special processing. (force print)
cmp al,ff ;is it a form feed?
je list6 ;yes, jump to special processing.
cmp al,eof ;is it end of file marker?
je list8 ;yes,jump to close files.
test blank_sub,-1 ;substitute blank char for control char?
jz list32 ;no
mov al,blank ;yes, replace ctl char with b